<?php
declare (strict_types = 1);

namespace app\admin\controller;

use app\admin\middleware\AdminAuth;
use app\admin\middleware\OperationLog;
use app\BaseController;
use app\Request;
use think\App;
use think\middleware\SessionInit;

/**
 * 管理后台基础控制器
 *
 * @Author tanruizheng
 * @DateTime 2021-07-08
 */
class AdminController extends BaseController
{
    /**
     * 无需登录的方法
     *
     * @var array
     * @Author tanruizheng
     * @DateTime 2021-07-09
     */
    public $noNeedLogin = [];

    /**
     * 无需验证的方法
     *
     * @var array
     * @Author tanruizheng
     * @DateTime 2021-07-09
     */
    public $noNeedPermission = [];

    protected $middleware  = [
        SessionInit::class,//开启session
        AdminAuth::class,//权限认证,
        OperationLog::class,//操作日志
    ];

    public function __construct(App $app)
    {
        parent::__construct($app);
        $app->request->noNeedLogin = $this->noNeedLogin;
        $app->request->noNeedPermission = $this->noNeedPermission;
    }

}
